package com.hy.singleton;

/**
 * Created With IntelliJ IDEA.
 * Descriptions:双重检查
 * <p>
 * User:Mr.Du
 * Date:2024/8/8
 * Time:17:36
 */
public class LazySingletonSecDoubleCheck {

    public static LazySingletonSecDoubleCheck instance;

    private LazySingletonSecDoubleCheck() {}

    public static LazySingletonSecDoubleCheck getInstance() {
        if(instance == null){
            synchronized (LazySingletonSecDoubleCheck.class){
                if(instance == null){
                    instance = new LazySingletonSecDoubleCheck();
                }
            }
        }
        return instance;
    }
}
